package com.ld.security.auth.server.config;

import com.ld.security.auth.common.base.po.LoginPo;
import com.ld.security.common.core.util.CrptUtil;
import org.springframework.security.crypto.password.PasswordEncoder;

/**
 *
 * 简单密码匹配器
 */

public class SimpPasswordEncoder implements PasswordEncoder {

    @Override
    public String encode(CharSequence charSequence) {
        return charSequence.toString();
    }

    @Override
    public boolean matches(CharSequence charSequence, String s) {

        LoginPo po =    new LoginPo();
        po.setPassword(charSequence.toString());
        CrptUtil.encrpt(po);


        boolean b =s.equals(po.getPassword());
       return b;
    }
}
